import Vue from 'vue'
import VueJsonp  from "vue-jsonp";
Vue.use(VueJsonp);


const urls = {
    multiget3:"https://mce.mogucdn.com/jsonp/multiget/3",
    search:"https://list.mogujie.com/search",
    jsonget:"https://mce.mogucdn.com/jsonp/get/3",
    mget:"https://list.mogujie.com/module/mget",
    comment:"https://rate.mogujie.com/h5/rate/jsonp/x6.rate.ratelist/v1"
}

const loadDataByPids = function(params={}){
    return Vue.jsonp(urls.multiget3,params);
}
const loadProductsByPid = function(params={}){
    return Vue.jsonp(urls.search,params);
}
const loadDataByPid= function(params={}){
    return Vue.jsonp(urls.jsonget,params);
}
const loadWords= function(params={}){
    return Vue.jsonp(urls.mget,params);
}
const loadComments= function(params={}){
    return Vue.jsonp(urls.comment,params);
}
// export default {
//     loadDataForMultiget3
// }

const api = {
    loadDataByPids,
    loadProductsByPid,
    loadDataByPid,
    loadWords,
    loadComments
}

export default {
    install:function(Vue){
        Vue.prototype.$api = api;
    },
    ...api
}
